function AugPath = augImages(DataPath, Aug, AugPath)

if ~isfield(Aug, 'angles')
    Aug.angles = 1 : 4;
end
if ~isfield(Aug, 'scales')
    Aug.scales = 0.6 : 0.1 : 0.7;  % 0.9;
end
if ~isfield(Aug, 'flip_dims')
    Aug.flip_dims = [1 2];
end

%%
Images = srimg.dirimgs(DataPath);
ImgNum = length(Images);
if ImgNum == 0
    error('Target image set path does not exist:\n\t%s', DataPath);
end

%% gen data aug path
if ~isdir(AugPath)
    mkdir(AugPath);
end

%%
% tic;
fprintf('Start augmenting images ...\n')
for i = 1 : ImgNum
    if mod(i, 20) == 0
        fprintf('\tImage %d  / %d \n', i, ImgNum);
    end
    filename = Images(i).name;
    [~, im_name] = fileparts(Images(i).name);
    x = imread(fullfile(DataPath, filename));
    
    for angle = Aug.angles % reverse rotate each respectively 90 180 270 360   0:1;3 is original is the same
        im_rot = rot90(x, angle);
        imwrite(im_rot, fullfile(AugPath, [im_name, '_rot' num2str(angle) '.bmp']));
        
        for scale = Aug.scales
            im_down = imresize(im_rot, scale, 'bicubic');
            imwrite(im_down, fullfile(AugPath, [im_name, '_rot' num2str(angle) '_s'  num2str(scale) '.bmp']));
        end
        
        for flip_dim = Aug.flip_dims
            imwrite(flip(x, flip_dim), fullfile(AugPath, [im_name, '_rot' num2str(angle) '_flip' num2str(flip_dim) '.bmp']));
        end
    end
end
disp('Augmenting images done!')
% toc;